#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   11:28
# Author     : Y4
# Site       : 工厂模式
# File       : factory.py

# 运算类
class yunsuan():
    __numberA = 0
    __numberB = 0

    @property
    def numberA(self):
        return self.__numberA

    @numberA.setter
    def numberA(self, value):
        self.__numberA = value

    @property
    def numberB(self):
        return self.__numberB

    @numberA.setter
    def numberB(self, value):
        self.__numberB = value

    def getRessult(self):
        result = 0
        return result


# 加法类
class Jia(yunsuan):
    def getRessult(self):
        return self.numberA + self.numberB


# 工厂类
class Factory():
    def createFactory(self, oper):
        fac = None  # 创建的工厂
        if oper == '+':
            fac = Jia()
        return fac


if __name__ == '__main__':
    jia = Factory().createFactory("+")
    jia.numberA = 50
    jia.numberB = 50
    result = jia.getRessult()
    print(result)
